from datetime import datetime
from app.common.model import BaseModel, RecodeMixinModel
from sqlalchemy import Column, DateTime, Integer, String, INT


class OrderModel(BaseModel):
    __tablename__ = 'order_info'

    id = Column(Integer, primary_key=True, autoincrement=True, comment='自增id')
    created_time = Column(DateTime, default=datetime.now(), comment='创建时间')
    order_id = Column(String(32), comment='订单id')
    client_id = Column(String(32), comment='客户id')
    qr_code = Column(String(32), comment='二维码')
    coupon_id = Column(String(32), comment='优惠券id')
    status = Column(INT, comment='订单状态(1待使用2已核销3过期)')
    cancel_time = Column(DateTime, comment='核销时间')
    def __repr__(self):
        return f"<Order(id={self.id}, order_id={self.order_id}, create_time={self.create_time})>"
